<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>2-8</title>
 <!--   引入jQuery --> 
 <script src="../scripts/jquery-1.3.1.js" type="text/javascript"></script>
 <link rel="stylesheet" type="text/css" href="../css/style.css" />  
  <script type="text/javascript">
  //<![CDATA[
  $(document).ready(function(){
      $('#reset').click(function(){
	      window.location.reload();
	  })
      //给id为mover的元素添加动画.
	   function animateIt() {
		  $("#mover").slideToggle("slow", animateIt);
	    }
		animateIt();
	  
		//选取所有不可见的元素.包括<input type="hidden"/>.
      $('#btn_hidden').click(function(){
	      alert( "不可见的元素有："+$('body :hidden').length +"个!\n"+
		   "其中不可见的div元素有:"+$('div:hidden').length+"个!\n"+
		   "其中文本隐藏域有:"+$('input:hidden').length+"个!");
		  $('div:hidden').show(3000).css("background","#bbffaa");
	  })
	  //选取所有可见的元素.
	  $('#btn_visible').click(function(){
		  $('div:visible').css("background","#FF6500");
	  })
  });
  //]]>
  </script>
</head>
<body>
  <h3>可见性过滤选择器.</h3>
  <button id="reset">手动重置页面元素</button><br/><br/>
  <input type="button" value="选取所有可见的div元素." id="btn_visible"/>
 <br/>
  <input type="button" value="选取所有不可见的元素.包括&lt;input type='hidden'/&gt;和&lt;div style='display:none;'&gt;." id="btn_hidden"/>

  <br /><br />
  <div class="one" id="one" >
 id为one,class为one的div
      <div class="mini">class为mini</div>
  </div>

    <div class="one"  id="two" title="test" >
	 id为two,class为one,title为test的div.
      <div class="mini"  title="other">class为mini,title为other</div>
      <div class="mini"  title="test">class为mini,title为test</div>
  </div>

  <div class="one">
      <div class="mini">class为mini</div>
      <div class="mini">class为mini</div>
	  <div class="mini">class为mini</div>
	  <div class="mini"></div>
  </div>

  

  <div class="one">
      <div class="mini">class为mini</div>
      <div class="mini">class为mini</div>
	  <div class="mini">class为mini</div>
	  <div class="mini"  title="tesst">class为mini,title为tesst</div>
  </div>


  <div style="display:none;"  class="none">style的display为"none"的div</div>
  
  <div class="hide">class为"hide"的div</div>
 
  <div>
  包含input的type为"hidden"的div<input type="hidden" size="8"/>
  </div>

  
  <span id="mover">正在执行动画的span元素.</span>
</body>
</html>
